<?php
include("../meihe/common.php");
if ($islogin == 1) {
} else exit("<script language='javascript'>window.location.href='./login.php';</script>");

?>
<div style="white-space:nowrap;overflow-x: auto;">
	<table class="layui-table layuiadmin-page-table">
		<thead>
			<tr>
				<th>ID</th>
				<th>域名</th>
				<th>QQ</th>
				<th>泛域名</th>
				<th>归属用户</th>
				<th>添加/到期时间</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<?php
			if (isset($_GET['search'])) {
				$sql = " domain='{$_GET['search']}' or qq='{$_GET['search']}'";
				$numrows = $DB->count("SELECT count(*) from meihe_list WHERE{$sql}");
				$con = '包含 <b>' . $_GET['search'] . '</b> 的共有 <b>' . $numrows . '</b> 个会员';
			} else {
				$numrows = $DB->count("SELECT count(*) from meihe_list");
				$sql = " 1";
				$con = '系统共有 <b>' . $numrows . '</b> 个会员';
			}
			$pagesize = isset($_GET['num']) ? intval($_GET['num']) : 30;
			$pages = ceil($numrows / $pagesize);
			$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
			$offset = $pagesize * ($page - 1);

			$rs = $DB->query("SELECT * FROM meihe_list WHERE{$sql} order by id desc limit $offset,$pagesize");
			while ($res = $DB->fetch($rs)) {
				echo '<tr><td>' . htmlspecialchars($res['id']) . '</td><td>' . htmlspecialchars($res['domain']) . '</td><td>' . $res['qq'] . '&nbsp;<a href="http://wpa.qq.com/msgrd?v=3&uin=' . $res['qq'] . '&site=qq&menu=yes">[<img src="../assets/icon/qqpay.ico" width="24">]</a></td><td>' . ($res['fhy'] == 2 ? '<span class="layui-btn layui-btn-sm" onclick="setActive3(' . $res['id'] . ',1)">开启</span>' : '<span class="layui-btn layui-btn-sm layui-btn-danger" onclick="setActive3(' . $res['id'] . ',2)">关闭</span>') . '</td><td>' . ($res['upzid'] ? '<font color="#FF5722" size="3">' . $userrow['user'] . '</font>' : '<font color="#01AAED" size="3">平台站长</font>') . '</td><td>' . $res['date'] . '<br/><a href="javascript:viphyxf(' . $res['id'] . ')" title="点击续期">' . $res['endtime'] . '</a></td><td><a href="./hylist.php?mod=edit&id=' . $res['id'] . '" class="btn btn-info btn-xs">编辑</a>&nbsp;<a href="./hylist.php?my=del&id=' . $res['id'] . '" class="btn btn-xs btn-danger " onclick="return confirm(\'你确实要删除此域名吗？\');">删除</a></td></tr>';
			}
			?>
		</tbody>
	</table>
</div>
<div class="text-center">
	<?php
	#分页
	$pageList = new Page($numrows, $pagesize, 1, $link ?? 0);
	echo $pageList->showPage();
	?>
</div>
<script>
	$("#blocktitle").html('<?php echo $con ?>');
</script>